package main.java.ensao.cryptography.elgamalmodule;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class InitializeListner  implements ActionListener {
	
	public void actionPerformed(ActionEvent e) {

		
		JPanel pan = (JPanel) ((JButton) e.getSource()).getParent();
		pan.setForeground(new Color(255, 255, 10));
		
		JTextField p = (JTextField) (((JPanel) pan.getComponent(1))).getComponent(1);
	    JTextField g = (JTextField) (((JPanel) pan.getComponent(2))).getComponent(1);
	    JTextField k = (JTextField) (((JPanel) pan.getComponent(4))).getComponent(1);
		JTextField b = (JTextField) (((JPanel) pan.getComponent(5))).getComponent(1);	
	   
		JTextField alpha = (JTextField) (((JPanel) pan.getComponent(7))).getComponent(1);
	    JTextField k_session = (JTextField) (((JPanel) pan.getComponent(8))).getComponent(1);

	    JTextField clair = (JTextField) (((JPanel) pan.getComponent(11))).getComponent(1);
	    JTextField chiffré = (JTextField) (((JPanel) pan.getComponent(12))).getComponent(1);
	    JTextField Kalpha = (JTextField) (((JPanel) pan.getComponent(13))).getComponent(1);
	   
	    
	    p.setText("");
	    g.setText("");
	    k.setText("");
	    b.setText("");
	    
	    alpha.setText("");
	    k_session.setText("");
	    
	    clair.setText("");
	    chiffré.setText("");
	    Kalpha.setText("");
	}

}
